import 'package:flutter/material.dart';

typedef WidgetBuilder<T> = Widget Function(T value);

class CommonListWidget<T> extends StatelessWidget {
  final WidgetBuilder<T> builderWidget;
  final List<T> data;

  CommonListWidget(this.builderWidget, this.data);

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
        key: PageStorageKey("x"),
        itemBuilder: (context, index) {
          return builderWidget(data[index]);
        },
        itemCount: data.length);
  }
}
